package com.xiqing.wechat.web.controller;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;

/**
 * Created by wanglijun on 17/3/30.
 */
public class TestOkHttp {

    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        Request requestOK = new Request.Builder()
                .url("http://api.parllay.cn/v1.1/social/wxconfig/7UOHYCCD9T/metadata/get?url=http%3A%2F%2Fwww.baidu.com&access_token=VL88poNAF6VVXvlIG6tMpii45U8D_bu97R7M2hVqb-WJYNNZ7SH66eNywa8ZMJ-2L6gU7mcRh3JraXspy2JSugVkGiWsLslszmZymuRytig")
                .get()
                .addHeader("cache-control", "no-cache")
                .addHeader("postman-token", "8fae5de5-9699-08a4-0a0d-89a6c9c1b4a5")
                .build();

        Response response = null;
        try {
            response = client.newCall(requestOK).execute();
        } catch (IOException e) {
            e.printStackTrace ();
        }
        System.out.println(response.body ().string ());
    }
}
